from django.db import models

# Create your models here.
# 客户表
class customers(models.Model):
    name=models.CharField(max_length=50)
    email=models.CharField(max_length=30,unique=True)
    password=models.CharField(max_length=50)
    phone=models.CharField(max_length=50)
    create_time=models.DateTimeField(auto_now_add=True)
    update_time=models.DateTimeField(auto_now=True)

# 订单表
class orders(models.Model):
    product_name=models.CharField(max_length=50)
    quantity=models.IntegerField()
    price =models.DecimalField(max_digits=6,decimal_places=2)
    customer_id=models.ForeignKey(customers,on_delete=models.CASCADE,related_name='orders')
    order_date=models.DateTimeField(auto_now_add=True)
    status=models.CharField(max_length=30)